package ua.kpi_java_training.evgeniygusar.module3.tests;

import org.junit.Test;
import ua.kpi_java_training.evgeniygusar.module3.*;

public class AllOstrichesTest {
    static Leopard p = new Leopard();
    static AllOstriches ostrichesObject = new AllOstriches();
    Desert mydesert = new Desert();
    int X_BORDER, Y_BORDER;

    public AllOstrichesTest() {
        X_BORDER = mydesert.getXBorder();
        Y_BORDER = mydesert.getYBorder();
    }

    @Test
    public void testNearestOstrich() throws Exception {
        p.x = 6;
        p.y = 5;

        ostrichesObject.addOstrich();
        ostrichesObject.getOstrich(0).x = 5;
        ostrichesObject.getOstrich(0).y = 4;

        ostrichesObject.addOstrich();
        ostrichesObject.getOstrich(1).x = 9;
        ostrichesObject.getOstrich(1).y = 9;

        ostrichesObject.nearestOstrich(p.x, p.y);
        assert(0==ostrichesObject.getIndexOfNearestOstrich());
        assert(5==ostrichesObject.getXOfNearestOstrich());
        assert(4==ostrichesObject.getYOfNearestOstrich());
    }

    @Test
    public void testAddVOstrich() throws Exception {
        ostrichesObject.addOstrich();
        assert(3==ostrichesObject.numbersOfOstriches());

    }

    @Test
    public void testGetOstrich() throws Exception {
        assert(5==ostrichesObject.getOstrich(0).x);
    }

    @Test
    public void testRemoveOstrich() throws Exception {
        ostrichesObject.removeOstrich(2);
        assert(2==ostrichesObject.numbersOfOstriches());
    }

    @Test
    public void testNumbersOfOstriches() throws Exception {
        assert(0==ostrichesObject.numbersOfOstriches());
    }

    @Test
    public void testDistance() throws Exception {
        assert(5==ostrichesObject.Distance(3,4));
    }
}
